package com.ruoyi.common.config;

import com.getui.push.v2.sdk.ApiHelper;
import com.getui.push.v2.sdk.GtApiConfiguration;
import com.getui.push.v2.sdk.api.PushApi;
import com.getui.push.v2.sdk.api.UserApi;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class GeTuiAutoConfig {
    @Bean
    @ConfigurationProperties(prefix = "getui")
    public GtApiConfiguration gtApiConfiguration() {
        return new GtApiConfiguration();
    }

    @Bean
    public ApiHelper apiHelper(GtApiConfiguration cfg) {
        return ApiHelper.build(cfg);
    }

    @Bean
    public PushApi pushApi(ApiHelper helper) {
        return helper.creatApi(PushApi.class);
    }

    @Bean
    public UserApi userApi(ApiHelper helper) {
        return helper.creatApi(UserApi.class);
    }
}
